<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
      <el-form-item label="订单号" prop="orderNo">
        <el-input
          v-model="queryParams.orderNo"
          placeholder="请输入订单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="排产编号" prop="pcCode">
        <el-input
          v-model="queryParams.pcCode"
          placeholder="请输入排产编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="排产日期" prop="pcDate">
        <el-date-picker clearable
          v-model="queryParams.pcDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择排产日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="生产线代码" prop="lineCode">
        <el-input
          v-model="queryParams.lineCode"
          placeholder="请输入生产线代码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生产线名称" prop="lineName">
        <el-input
          v-model="queryParams.lineName"
          placeholder="请输入生产线名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工位代码" prop="gwCode">
        <el-input
          v-model="queryParams.gwCode"
          placeholder="请输入工位代码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工位名称" prop="gwName">
        <el-input
          v-model="queryParams.gwName"
          placeholder="请输入工位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="物料识别码" prop="itemIdentifyCode">
        <el-input
          v-model="queryParams.itemIdentifyCode"
          placeholder="请输入物料识别码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="审核状态" prop="isSh">
        <el-select v-model="queryParams.isSh" placeholder="请选择">
          <el-option
            v-for="item in isShOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleRead"
        >读取</el-button>
      </el-col>
       <el-col :span="1.5">
       <el-button
         type="primary"
         plain
         icon="el-icon-s-check"
         size="mini"
         :disabled="multiple"
         @click="handleSh"
         v-hasPermi="['procontrol:control:sh']"
       >审核</el-button>
     </el-col>
     <!-- <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['procontrol:control:edit']"
        >修改</el-button>
      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['procontrol:control:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['procontrol:control:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="controlList" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="公司代码" align="center" prop="factoryCode" />
      <el-table-column label="公司名称" align="center" prop="factoryName" />
      <el-table-column label="订单号" width="150" align="center" prop="orderNo" />
      <el-table-column label="排产编号" width="150" align="center" prop="pcCode" />
      <el-table-column label="排产日期" align="center" prop="pcDate" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.pcDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="交货日期" align="center" prop="jhDate" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.jhDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="合同号" width="130" align="center" prop="contractNo" />
      <el-table-column label="生产日期" align="center" prop="scDate" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="产品类型" width="130" align="center" prop="proType" />
      <el-table-column label="车间编码" width="130" align="center" prop="cjCode" />
      <el-table-column label="车间名称" width="130" align="center" prop="cjName" />
      <el-table-column label="生产线代码" width="130" align="center" prop="lineCode" />
      <el-table-column label="生产线名称" width="130" show-overflow-tooltip align="center" prop="lineName" />
      <el-table-column label="工位代码" width="130" align="center" prop="gwCode" />
      <el-table-column label="工位名称" show-overflow-tooltip width="130" align="center" prop="gwName" />
      <el-table-column label="设备编号" width="130" align="center" prop="deviceNo" />
      <el-table-column label="设备名称" width="130" show-overflow-tooltip align="center" prop="deviceName" />
      <el-table-column label="工序产品编号" width="130" align="center" prop="gxProCode" />
      <el-table-column label="对应产品编号" show-overflow-tooltip width="140"  align="center" prop="dyProCode" />
       <el-table-column label="对应整车图号" align="center" prop="dyZcNum" />
      <el-table-column label="未排产订单数量" align="center" prop="noPcNum" />
      <el-table-column label="排产数量" align="center" prop="pcNum" />
      <el-table-column label="实际完成数量" width="100" align="center" prop="finishComNum" />
      <el-table-column label="派工数量" align="center" prop="pgNum" />
      <el-table-column label="完工数量" align="center" prop="wgNum" />
      <el-table-column label="报工数量" align="center" prop="bgNum" />
      <el-table-column label="在制品数量" width="100" align="center" prop="zzNum" />
      <el-table-column label="检验数量" align="center" prop="checkNum" />
      <el-table-column label="不合格数量" width="100" align="center" prop="unqualifiedNum" />
      <el-table-column label="返修数量" align="center" prop="returnNum" />
      <el-table-column label="料废数量" align="center" prop="flNum" />
      <el-table-column label="机废数量" align="center" prop="jfNum" />
      <el-table-column label="计划上线时间" align="center" prop="planOnlineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.planOnlineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="实际上线时间" align="center" prop="actualOnlineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.actualOnlineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="计划下线时间" align="center" prop="planOfflineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.planOfflineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="实际下线时间" align="center" prop="actualOfflineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.actualOfflineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="返修上线时间" align="center" prop="returnOnlineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.returnOnlineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="返修下线时间" align="center" prop="returnOfflineTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.returnOfflineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="报工时间" align="center" prop="bgTimr" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.bgTimr, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="检验时间" align="center" prop="checkTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.checkTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="质检员工号" width="100" align="center" prop="checkUserNum" />
      <el-table-column label="质检员姓名" width="100" align="center" prop="checkUserName" />
      <el-table-column label="包装时间" align="center" prop="packgeTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.packgeTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="核销时间" align="center" prop="hxTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.hxTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="材料" width="120" align="center" prop="cl" />
      <el-table-column label="下料" width="120" align="center" prop="xl" />
      <el-table-column label="加热" width="120" align="center" prop="jr" />
      <el-table-column label="成型" width="120" align="center" prop="cx" />
      <el-table-column label="冷却" width="120" align="center" prop="lq" />
      <el-table-column label="粗车" width="120" align="center" prop="cc" />
      <el-table-column label="精车" width="120" align="center" prop="jc" />
      <el-table-column label="钻孔" width="120" align="center" prop="zk" />
      <el-table-column label="检验" width="120" align="center" prop="jy" />
      <el-table-column label="包装" width="120" align="center" prop="bz" />
      <el-table-column label="创建时间" width="160" align="center" prop="createTime" />
      <el-table-column label="创建者" align="center" prop="createBy" />
      <el-table-column label="更新时间" width="160" align="center" prop="updateTime" />
      <el-table-column label="更新者" align="center" prop="updateBy" />
      <el-table-column label="备注" width="150" show-overflow-tooltip align="center" prop="remark" />
      <el-table-column fixed="right" label="操作" width="150" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-if="scope.row.isSh != '1'"
            v-hasPermi="['procontrol:control:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-if="scope.row.isSh != '1'"
            v-hasPermi="['procontrol:control:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改生产过程控制总对话框 -->
    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="125px">
        <el-row>
          <el-col :span="12">
          <el-form-item label="排产编号" prop="pcCode">
          <el-input readonly v-model="form.pcCode" placeholder="请输入排产编号" readonly/>
        </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="排产日期" prop="pcDate">
            <el-date-picker clearable
              v-model="form.pcDate"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="请选择排产日期">
            </el-date-picker>
          </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="物料名称" prop="proName">
              <el-input  v-model="form.proName" placeholder="产品名称" readonly/>
            </el-form-item>
          </el-col>
<!--          <el-col :span="12">-->
<!--            <el-form-item label="物料识别码" prop="itemIdentifyCode">-->
<!--              <el-input  v-model="form.itemIdentifyCode" placeholder="物料识别码" readonly/>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
        </el-row>
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="外径公差" prop="wjgc">-->
<!--              <el-input v-model="form.wjgc" placeholder="外径公差" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="内径公差" prop="njgc">-->
<!--              <el-input v-model="form.njgc" placeholder="内径公差" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="厚度公差" prop="hdgc">-->
<!--              <el-input v-model="form.hdgc" placeholder="厚度公差" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="台径*台高" prop="tjtg">-->
<!--              <el-input v-model="form.tjtg" placeholder="台径*台高" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="中心距" prop="zxj">-->
<!--              <el-input v-model="form.zxj" placeholder="中心距" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="孔径+孔数" prop="kjks">-->
<!--              <el-input v-model="form.kjks" placeholder="孔径+孔数" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="计算重量" prop="jszl">-->
<!--              <el-input v-model="form.jszl" placeholder="计算重量" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="下料重量" prop="xlzl">-->
<!--              <el-input v-model="form.xlzl" placeholder="下料重量" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
        <el-row>
        <el-col :span="12">
          <el-form-item label="产线代码" prop="lineCode">
            <el-input readonly v-model="form.lineCode" placeholder="生产线代码" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="产线名称" prop="lineName">
            <el-input readonly v-model="form.lineName" placeholder="产线名称" />
          </el-form-item>
        </el-col>
      </el-row>
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="倒角" prop="dj">-->
<!--              <el-input  v-model="form.dj" placeholder="倒角" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="水线" prop="sx">-->
<!--              <el-input  v-model="form.sx" placeholder="水线" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
<!--        <el-row>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="密封面倒角" prop="mfmdj">-->
<!--              <el-input  v-model="form.mfmdj" placeholder="密封面倒角" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="说明" prop="content">-->
<!--              <el-input  v-model="form.content" placeholder="说明" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
        <el-row>
          <el-col :span="12">
          <el-form-item label="工位代码" prop="gwCode">
          <el-select filterable clearable @change="getGwCode" v-model="form.gwCode" placeholder="请选择工位代码">
            <el-option
              v-for="item in gwCodeList"
              :key="item.stationCode"
              :label="item.stationName"
              :value="item.stationCode">
            </el-option>
          </el-select>
        </el-form-item>
          </el-col>
            <el-col :span="12">
              <el-form-item label="工位人员数量" prop="gwPersonNum">
                <el-input v-model="form.gwPersonNum" placeholder="请输入工位人员数量" />
              </el-form-item>
            </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
        <el-form-item label="派工工位编码" prop="pgGwCode">
          <el-input v-model="form.pgGwCode" placeholder="请输入派工工位编码" />
        </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="派工工位名称" prop="pgGwName">
          <el-input v-model="form.pgGwName" placeholder="请输入派工工位名称" />
        </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
        <el-form-item label="派工工位负责人" prop="pgGwFzr2">
          <el-input v-model="form.pgGwFzr2" placeholder="请输入派工工位负责人" />
        </el-form-item>
          </el-col>
          <el-col :span="12">
          <el-form-item label="派工工位操作人员" prop="gwPersonInfo2">
          <el-input v-model="form.gwPersonInfo2" placeholder="请输入派工工位操作人员" />
        </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {listControl, getControl, delControl, addControl, updateControl, handRead,shControl} from "@/api/procontrol/control";
import {listProcessTec} from "@/api/technology/processTec";

export default {
  name: "Control",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      lineCode: null,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 生产过程控制总表格数据
      controlList: [],

      gwCodeList: [],
      isShOptions: [{
        value: '0',
        label: '未审核'
      }, {
        value: '1',
        label: '已审核'
      }],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        factoryCode: null,
        factoryName: null,
        orderNo: null,
        choose: null,
        contractNo: null,
        pcCode: null,
        pcDate: null,
        scDate: null,
        jhDate: null,
        lineCode: null,
        lineName: null,
        gwCode: null,
        gwName: null,
        deviceNo: null,
        deviceName: null,
        empNum: null,
        empName: null,
        proType: null,
        gxProCode: null,
        proName: null,
        dyProCode: null,
        dyYclCode: null,
        dyZcNum: null,
        orderNum: null,
        noPcNum: null,
        pcNum: null,
        finishComNum: null,
        pgNum: null,
        wgNum: null,
        bgNum: null,
        zzNum: null,
        checkNum: null,
        unqualifiedNum: null,
        returnNum: null,
        flNum: null,
        jfNum: null,
        planOnlineTime: null,
        actualOnlineTime: null,
        planOfflineTime: null,
        actualOfflineTime: null,
        returnOnlineTime: null,
        returnOfflineTime: null,
        bgTimr: null,
        checkTime: null,
        checkUserNum: null,
        checkUserName: null,
        packgeTime: null,
        hxTime: null,
        cl: null,
        xl: null,
        jr: null,
        cx: null,
        lq: null,
        cc: null,
        jc: null,
        zk: null,
        jy: null,
        bz: null,
        isSh:null,
        itemIdentifyCode:null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        dyProCode:[
          { required: true, message: "物料编号不能为空", trigger: "blur" }
        ],
        lineCode:[
          { required: true, message: "生产线代码不能为空", trigger: "blur" }
        ],
        gwCode:[
          { required: true, message: "请选择工位编码", trigger: "blur" }
        ],
       stationCode: [
          { required: true, message: "请选择派工工位编码", trigger: "blur" }
        ],
        pgGwCode: [
          { required: true, message: "派工工位编码不能为空", trigger: ["blur", "change"] }
        ],
        pgGwName: [
          { required: true, message: "派工工位名称不能为空", trigger: ["blur", "change"] }
        ],
        pgGwFzr2: [
          { required: true, message: "派工工位负责人不能为空", trigger: ["blur", "change"] }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询生产过程控制总列表 */
    getList() {
      this.loading = true;
      listControl(this.queryParams).then(response => {
        this.controlList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    tableRowClassName({row, rowIndex}) {
      if (row.isSh == 0) {
        return 'warning-row';
      } else{
        return '';
      }
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        factoryCode: null,
        factoryName: null,
        orderNo: null,
        choose: null,
        contractNo: null,
        pcCode: null,
        pcDate: null,
        scDate: null,
        jhDate: null,
        lineCode: null,
        lineName: null,
        gwCode: null,
        gwName: null,
        deviceNo: null,
        deviceName: null,
        empNum: null,
        empName: null,
        proType: null,
        gxProCode: null,
        proName: null,
        dyProCode: null,
        dyYclCode: null,
        dyZcNum: null,
        orderNum: null,
        noPcNum: null,
        pcNum: null,
        finishComNum: null,
        pgNum: null,
        wgNum: null,
        bgNum: null,
        zzNum: null,
        checkNum: null,
        unqualifiedNum: null,
        returnNum: null,
        flNum: null,
        jfNum: null,
        planOnlineTime: null,
        actualOnlineTime: null,
        planOfflineTime: null,
        actualOfflineTime: null,
        returnOnlineTime: null,
        returnOfflineTime: null,
        bgTimr: null,
        checkTime: null,
        checkUserNum: null,
        checkUserName: null,
        packgeTime: null,
        hxTime: null,
        cl: null,
        xl: null,
        jr: null,
        cx: null,
        lq: null,
        cc: null,
        jc: null,
        zk: null,
        jy: null,
        bz: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.lineCode = selection.map(item => item.lineCode)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    getGwCode(value){
      let selectedName = {};
      selectedName = this.gwCodeList.find((item)=>{
        return item.stationCode === value;
        //筛选出匹配数据，是对应数据的整个对象
      });
      this.form.stationName=selectedName.stationName;
      this.form.pgGwName=selectedName.pgGwName;
      this.form.pgGwCode=selectedName.pgGwCode;
      this.form.pgGwFzr=selectedName.pgGwFzr;
      this.form.pgGwFzr1=selectedName.pgGwFzr1;
      this.form.pgGwFzr2=selectedName.pgGwFzr2;
      this.form.gwPersonNum=selectedName.gwPersonNum;
      this.form.gwPersonInfo=selectedName.gwPersonInfo;
      this.form.gwPersonInfo1=selectedName.gwPersonInfo1;
      this.form.gwPersonInfo2=selectedName.gwPersonInfo2;
      this.form.gwName=selectedName.gwName;
      this.$forceUpdate();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加生产过程控制总";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      const lineCode = row.lineCode
      let param = {
        proLineCode:lineCode,
        pageNum: 1,
        pageSize: 10000,
      };
      getControl(id).then(response => {
        listProcessTec(param).then(res=>{
          this.gwCodeList = res.rows;
          this.form = response.data;
          this.open = true;
          this.title = "审核生产过程控制审核";
        })
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            //this.form.isSh='1';
            updateControl(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addControl(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 审核按钮操作 */
    handleSh(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认审核勾选的信息？').then(function() {
        return shControl(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("审核成功");
      }).catch(() => {});
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除生产过程控制总编号为"' + ids + '"的数据项？').then(function() {
        return delControl(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('procontrol/control/export', {
        ...this.queryParams
      }, `control_${new Date().getTime()}.xlsx`)
    },
    handleRead(){
      const loading = this.$loading({
        lock: true,
        text: '正在读取排产数据，请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      handRead().then(response => {
        this.$modal.msgSuccess("读取完成！");
        this.getList();
        loading.close();
      }).catch(reason=>{
        loading.close();
      });
    }
  }
};
</script>
<style lang="scss" scoped>
  ::v-deep .el-table .warning-row {
    background: #ffe4e1;
  }
</style>
